package com.syf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.syf.domain.CoinType;
import com.syf.mapper.CoinTypeMapper;
import com.syf.service.CoinTypeService;
/**
*
*
*@author 苏耀奋
*@create 2021-10-12 18:48
*/
@Service
public class CoinTypeServiceImpl extends ServiceImpl<CoinTypeMapper, CoinType> implements CoinTypeService{

    /**
     * 条件分页查询-币种类型
     * @param page 分页的参数
     * @param code 币种类型code
     * @return
     */
    @Override
    public Page<CoinType> fingByPage(Page<CoinType> page, String code) {
        return page(page,new LambdaQueryWrapper<CoinType>()
                .like(!StringUtils.isEmpty(code), CoinType::getCode, code));
    }

    /**
     * 根据币种类型的状态查询 所有币种类型的值
     * @param status 币种的状态
     * @return
     */
    @Override
    public List<CoinType> listByStatus(Byte status) {
        return list(new LambdaQueryWrapper<CoinType>()
                .eq(status != null,CoinType::getStatus,status));
    }
}
